package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 综合服务展会
 * </p>
 *
 * @author linan
 * @date 2022-07-15
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ExhibitionManageFinishStateEnum", description = "展会完成状态 #{NOT_STARTED:未开始;HAVE_IN_HAND:进行中;COMPLETED:已结束")
public enum ExhibitionManageFinishStateEnum implements BaseEnum {

    /**
     * NOT_STARTED="未开始"
     */
    NOT_STARTED("未开始"),
    /**
     * HAVE_IN_HAND="进行中"
     */
    HAVE_IN_HAND("进行中"),
    /**
     * COMPLETED="已结束"
     */
    COMPLETED("已结束"),
    /**
     * NOT_COMPLETED=未结束
     */
    NOT_COMPLETED("未结束"),

    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ExhibitionManageFinishStateEnum match(String val, ExhibitionManageFinishStateEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ExhibitionManageFinishStateEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ExhibitionManageFinishStateEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "NOT_STARTED,HAVE_IN_HAND,COMPLETED", example = "NOT_STARTED")
    public String getCode() {
        return this.name();
    }

}
